package leetCode.secondWeek;

public class Code_12 {

    public String res = "";
    public int[] map = new int[]{1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
    public String[] mapStr = new String[]{"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};

    public String intToRoman(int num) {
        recursion(num);
        return res;
    }

    public void recursion(int num) {
        for (int i = 0; i < map.length; i++) {
            if (num / map[i] >= 1) {
                res += mapStr[i];
                recursion(num - map[i]);
                return;
            }
        }
    }
}
